{% extends "scan/base.html" %}
{% block js %}
<script type="text/javascript">
$(document).ready(function() {
	//$('#id_test').change(function(){Dajaxice.scan.updatecombo(Dajax.process, {'option':this.value});});
	$('#id_place').change(function(){Dajaxice.scan.updatesubj(Dajax.process, {'place':this.value});});
});
</script>
{% endblock %}
{% block body_main %}
<table border="0">
<tr>
<td>
{% include "paginator.html" %}
</td>
<td>
 <label for="lpp">Строк:</label>
 <!--select onchange="document.location=this.options[this.selectedIndex].value"-->
 <select onchange="document.location=this.options[this.selectedIndex].value">
  <option value="{% url scan.views.scan_set_lpp 10 %}" {% ifequal lpp 10 %}selected{% endifequal %}>10</option>
  <option value="{% url scan.views.scan_set_lpp 15 %}" {% ifequal lpp 15 %}selected{% endifequal %}>15</option>
  <option value="{% url scan.views.scan_set_lpp 20 %}" {% ifequal lpp 20 %}selected{% endifequal %}>20</option>
  <option value="{% url scan.views.scan_set_lpp 25 %}" {% ifequal lpp 25 %}selected{% endifequal %}>25</option>
  <option value="{% url scan.views.scan_set_lpp 50 %}" {% ifequal lpp 50 %}selected{% endifequal %}>50</option>
 </select>
</td>
</tr>
</table>
<table>
 <thead>
 <tr>
  <th> # </th>
  <th> Объект </th>
  <th> Подобъект </th>
  <th> Направление </th>
  <th> Поставщик </th>
  <th> Номер </th>
  <th> Дата </th>
  <th> Сумма </th>
 </tr>
<form action="{% url scan.views.scan_list %}" method="POST">
{% csrf_token %}
 <tr>
  <th/>
  <th> {{ form.place }} <br/> {{ form.place.errors }} </th>
  <th> <select name="subject" id="id_subject">
	{% if subjs %}
		{% for k, v in subjs %}
		<option value="{{k}}" {% ifequal subj k %}selected="selected"{% endifequal %}>{{v}}</option>
		{% endfor %}
	{% endif %}
  </select> </th>
  <th> {{ form.depart }} <br/> {{ form.depart.errors }} </th>
  <th> {{ form.supplier }} <br/> {{ form.supplier.errors }} </th>
  <th> {{ form.billno }} <br/> {{ form.billno.errors }} </th>
  <th> {{ form.billdate }} <br/> {{ form.billdate.errors }} </th>
  <th> {% include "button/filter.html" %} </th>
 </tr>
</form>
 </thead>
 <tbody>
{% for object in object_list %}
 <tr>
  <td> <a href="{% url scan.views.scan_view object.pk %}"> {{ object.pk }} </a> </td>
  <td> {{ object.place }} </td>
  <td> {{ object.subject|default:"---" }} </td>
  <td> {% if object.depart %} {{ object.depart }} {% else %} --- {% endif %} </td>
  <td> {{ object.supplier }} </td>
  <td> {{ object.no }} </td>
  <td> {{ object.date|date:"d.m.y" }} </td>
  <td> {{ object.sum|default:"---" }} </td>
 </tr>
{% endfor %}
</table>
{% endblock %}
